﻿using UnityEngine;

namespace KuiHuaBaoDian.Services.UGUI {

    /// <summary>
    /// 背景遮罩选项
    /// </summary>
    public static class UIBlockingOptions {

        /// <summary>
        /// 实例化
        /// </summary>
        /// <param name="color">RGBA颜色</param>
        public static IUIBlockingOptions Instantate(Color color = default) {
            var instance = KHBD.TypeMap.Instantiate<IUIBlockingOptions>();
            (instance as IUIBlockingOptions.IInitializable).Initialize(color);
            return instance;
        }
    }

    /// <summary>
    /// 背景遮罩选项
    /// </summary>
    public interface IUIBlockingOptions {

        /// <summary>
        /// 初始化写接口
        /// </summary>
        public interface IInitializable {

            /// <summary>
            /// 初始化
            /// </summary>
            /// <param name="color">RGBA颜色</param>
            void Initialize(Color color = default);
        }

        /// <summary>
        /// RGBA颜色
        /// </summary>
        Color Color { get; }
    }

    [Implement(typeof(IUIBlockingOptions))]
    internal sealed class KHBD_UIBlockingOptions : IUIBlockingOptions, IUIBlockingOptions.IInitializable {

        public Color Color { get; private set; }

        void IUIBlockingOptions.IInitializable.Initialize(Color color) {
            Color = color;
        }
    }
}
